#
# Copyright (c) 2024 Black Sesame Technologies
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import sys
from code_gen import code_gen
from cmake_gen import cmake_gen
from package import package
from android_func import android_func


if __name__ == '__main__':
    if len(sys.argv) > 1:
        path = sys.argv[1]
    else:
        print("Error! please provide package path.")
        sys.exit(1)
    
    # use dalidl to generate msg class type files and typesupport files
    ret = code_gen(path)
    if ret != 0:
        print("code_gen failed. stopped!" , end='\n', file=sys.stderr, flush=True)
        sys.exit(1)
    
    # modify Andriod.bp
    ret = android_func(path)
    if ret != 0:
        print("android_func failed. stopped!" , end='\n', file=sys.stderr, flush=True)
        sys.exit(1)
